﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity.Configuration;

using SysConfiguration = System.Configuration.Configuration;
using System.Configuration;
namespace Tjb.Config
{
    public interface IConfigBase
    {
    }

    public static class ConfigurationFixtureBase
    {
        public static SysConfiguration OpenConfigFile(this IConfigBase iconfig, String configFileName)
        {
            ExeConfigurationFileMap map = new ExeConfigurationFileMap();
            map.ExeConfigFilename = configFileName;
            return ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
        }
        public static UnityConfigurationSection GetUnitySection(this IConfigBase iconfig, String configFileName, string sectionName)
        {
            SysConfiguration config = iconfig.OpenConfigFile(configFileName);
            return (UnityConfigurationSection)config.GetSection(sectionName);
        }
    }
}
